<template>
  <div class="article-content">
    <!-- 公共头 -->
    <header class="header-fiexed"
            v-if="showHead">
      <van-nav-bar :title="article.document_title || ''"
                   left-arrow
                   @click-left="$router.go(-1)" />
    </header>

    <div class="article-main"
         v-html="article.document_content">
    </div>
  </div>
</template>

<script>
import { agreement } from '@/api/common'
import { Toast } from 'vant'
export default {
  name: 'Article',
  data() {
    return {
      article: {}
    }
  },
  props: {
    showHead: {
      type: Boolean,
      default: true
    }
  },
  created() {
    Toast.loading('加载中')
    agreement()
      .then(res => {
        this.article = res.result
        window.document.title = res.result.document_title || '' // title 更改
        Toast.clear()
      })
      .catch(res => {
        Toast.clear()
      })
  }
}
</script>

<style lang="scss">
.article-content {
  .article-main {
    padding: 20px;
    * {
      font-size: 16px !important;
      line-height: 1.5;
      background-color: transparent !important;
    }
  }
}
</style>
